From: awilliam@xenbuild.aw Date: Mon, 5 Jun 2006 20:23:57 +0000 (-0600) Subject: [IA64] pass vcpu nr to guest firmware X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15995 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=ae0bcae60a74e4fd2193e15db29fb819e27514f0;p=xen.git [IA64] pass vcpu nr to guest firmware This patch pass the vcpus number to VT-i domain guest firmware, so that guest firmware can set SMP info accordingly, mostly in ACPI MADT table. This patch is required by VT-i SMP support. Signed-off-by: Yu Ke --- diff --git a/tools/libxc/xc_ia64_stubs.c b/tools/libxc/xc_ia64_stubs.c index 58d07477cc..924d9d3d5f 100644 --- a/tools/libxc/xc_ia64_stubs.c +++ b/tools/libxc/xc_ia64_stubs.c @@ -207,18 +207,21 @@ typedef enum { HOB_TYPE_PAL_VM_SUMMARY, HOB_TYPE_PAL_VM_INFO, HOB_TYPE_PAL_VM_PAGE_SIZE, + HOB_TYPE_NR_VCPU, HOB_TYPE_MAX }hob_type_t; static int hob_init( void *buffer ,unsigned long buf_size); static int add_pal_hob(void* hob_buf); static int add_mem_hob(void* hob_buf, unsigned long dom_mem_size); +static int add_vcpus_hob(void* hob_buf, unsigned long nr_vcpu); static int build_hob (void* hob_buf, unsigned long hob_buf_size, - unsigned long dom_mem_size); + unsigned long dom_mem_size, unsigned long vcpus); static int load_hob(int xc_handle,uint32_t dom, void *hob_buf, unsigned long dom_mem_size); -int xc_ia64_build_hob(int xc_handle, uint32_t dom, unsigned long memsize){ +int xc_ia64_build_hob(int xc_handle, uint32_t dom, unsigned long memsize, + unsigned long vcpus){ char *hob_buf; @@ -228,7 +231,7 @@ int xc_ia64_build_hob(int xc_handle, uint32_t dom, unsigned long memsize){ return -1; } - if ( build_hob( hob_buf, GFW_HOB_SIZE, memsize) < 0){ + if ( build_hob( hob_buf, GFW_HOB_SIZE, memsize, vcpus) < 0){ free (hob_buf); PERROR("Could not build hob"); return -1; @@ -329,7 +332,7 @@ int get_hob_size(void* hob_buf){ } int build_hob (void* hob_buf, unsigned long hob_buf_size, - unsigned long dom_mem_size) + unsigned long dom_mem_size, unsigned long vcpus) { //Init HOB List if (hob_init (hob_buf, hob_buf_size)<0){ @@ -342,6 +345,11 @@ int build_hob (void* hob_buf, unsigned long hob_buf_size, goto err_out; } + if ( add_vcpus_hob(hob_buf, vcpus)<0){ + PERROR("Add NR_VCPU hob failed, buffer too small"); + goto err_out; + } + if ( add_pal_hob( hob_buf ) < 0 ){ PERROR("Add PAL hob failed, buffer too small"); goto err_out; @@ -400,6 +408,12 @@ add_mem_hob(void* hob_buf, unsigned long dom_mem_size){ return 0; } +static int +add_vcpus_hob(void* hob_buf, unsigned long vcpus) +{ + return hob_add(hob_buf, HOB_TYPE_NR_VCPU, &vcpus, sizeof(vcpus)); +} + unsigned char config_pal_bus_get_features_data[24] = { 0, 0, 0, 32, 0, 0, 240, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 @@ -630,7 +644,7 @@ static int setup_guest( int xc_handle, } /* Hand-off state passed to guest firmware */ - if (xc_ia64_build_hob(xc_handle, dom, dom_memsize) < 0){ + if (xc_ia64_build_hob(xc_handle, dom, dom_memsize, (unsigned long)vcpus) < 0){ PERROR("Could not build hob\n"); goto error_out; }